public class Test {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if (i % 10 == 9) {        //得到个位上的9
                count++;
            }
            if (i / 10 == 9) {        //得到十位上的9
                count++;
            }
        }
        System.out.println(count);
    }

    public static void main1(String[] args) {
        int count = 0;
        int flag = 0;
        int sum = 0;
        for (int i = 1; i <= 100 ; i++) {
            if(i % 10 == 9){        //得到个位上的9
                count ++;
            }
        }
        for (int i = 1; i <= 100 ; i++) {
            if(i / 10 == 9){        //得到十位上的9
               flag++;
            }
        }
        sum = count +flag;
        System.out.println(sum);
    }
}
